import { reactive } from "../../reactive";
import { effect, depsMap } from "../../effect/effect";

const state = reactive({
  a: 123,
  b: 456,
  c: 789,
});

// 每次执行effect的函数时，就去重新收集一遍依赖
effect(() => {
  if (state.a > 100) state.b;
  else state.c;
  console.log("完整的depsMap：", depsMap);
  console.log("effect被执行啦");
  console.log("-----------------");
});

state.a = 1;

// 此时又会有个问题：这次是将c依赖收集了，但是b应该去掉依赖收集，b的改变并不会再触发effect了
